3.7 \(\int \cot ^4(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx\)

Optimal. Leaf size=89 \[ -\frac{a (B+i A) \cot ^2(c+d x)}{2 d}+\frac{a (A-i B) \cot (c+d x)}{d}-\frac{a (B+i A) \log (\sin (c+d x))}{d}+a x (A-i B)-\frac{a A \cot ^3(c+d x)}{3 d} \]

[Out]

a*(A - I*B)*x + (a*(A - I*B)*Cot[c + d*x])/d - (a*(I*A + B)*Cot[c + d*x]^2)/(2*d) - (a*A*Cot[c + d*x]^3)/(3*d)
 - (a*(I*A + B)*Log[Sin[c + d*x]])/d

________________________________________________________________________________________

Rubi [A]  time = 0.152381, antiderivative size = 89, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 32, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.125, Rules used = {3591, 3529, 3531, 3475} \[ -\frac{a (B+i A) \cot ^2(c+d x)}{2 d}+\frac{a (A-i B) \cot (c+d x)}{d}-\frac{a (B+i A) \log (\sin (c+d x))}{d}+a x (A-i B)-\frac{a A \cot ^3(c+d x)}{3 d} \]

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

a*(A - I*B)*x + (a*(A - I*B)*Cot[c + d*x])/d - (a*(I*A + B)*Cot[c + d*x]^2)/(2*d) - (a*A*Cot[c + d*x]^3)/(3*d)
 - (a*(I*A + B)*Log[Sin[c + d*x]])/d

Rule 3591

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e
_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((b*c - a*d)*(A*b - a*B)*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)*(a^2
 + b^2)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[a*A*c + b*B*c + A*b*d - a*B*d - (A*b*
c - a*B*c - a*A*d - b*B*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0]
 && LtQ[m, -1] && NeQ[a^2 + b^2, 0]

Rule 3529

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^(m + 1))/(f*(m + 1)*(a^2 + b^2)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e +
f*x])^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
 - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \cot ^4(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx &=-\frac{a A \cot ^3(c+d x)}{3 d}+\int \cot ^3(c+d x) (a (i A+B)-a (A-i B) \tan (c+d x)) \, dx\\ &=-\frac{a (i A+B) \cot ^2(c+d x)}{2 d}-\frac{a A \cot ^3(c+d x)}{3 d}+\int \cot ^2(c+d x) (-a (A-i B)-a (i A+B) \tan (c+d x)) \, dx\\ &=\frac{a (A-i B) \cot (c+d x)}{d}-\frac{a (i A+B) \cot ^2(c+d x)}{2 d}-\frac{a A \cot ^3(c+d x)}{3 d}+\int \cot (c+d x) (-a (i A+B)+a (A-i B) \tan (c+d x)) \, dx\\ &=a (A-i B) x+\frac{a (A-i B) \cot (c+d x)}{d}-\frac{a (i A+B) \cot ^2(c+d x)}{2 d}-\frac{a A \cot ^3(c+d x)}{3 d}-(a (i A+B)) \int \cot (c+d x) \, dx\\ &=a (A-i B) x+\frac{a (A-i B) \cot (c+d x)}{d}-\frac{a (i A+B) \cot ^2(c+d x)}{2 d}-\frac{a A \cot ^3(c+d x)}{3 d}-\frac{a (i A+B) \log (\sin (c+d x))}{d}\\ \end{align*}

Mathematica [C]  time = 0.689976, size = 102, normalized size = 1.15 \[ -\frac{a \left (2 A \cot ^3(c+d x) \text{Hypergeometric2F1}\left (-\frac{3}{2},1,-\frac{1}{2},-\tan ^2(c+d x)\right )+6 i B \cot (c+d x) \text{Hypergeometric2F1}\left (-\frac{1}{2},1,\frac{1}{2},-\tan ^2(c+d x)\right )+3 (B+i A) \left (\cot ^2(c+d x)+2 (\log (\tan (c+d x))+\log (\cos (c+d x)))\right )\right )}{6 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

-(a*(2*A*Cot[c + d*x]^3*Hypergeometric2F1[-3/2, 1, -1/2, -Tan[c + d*x]^2] + (6*I)*B*Cot[c + d*x]*Hypergeometri
c2F1[-1/2, 1, 1/2, -Tan[c + d*x]^2] + 3*(I*A + B)*(Cot[c + d*x]^2 + 2*(Log[Cos[c + d*x]] + Log[Tan[c + d*x]]))
))/(6*d)

________________________________________________________________________________________

Maple [A]  time = 0.061, size = 129, normalized size = 1.5 \begin{align*}{\frac{-{\frac{i}{2}}Aa \left ( \cot \left ( dx+c \right ) \right ) ^{2}}{d}}-{\frac{iAa\ln \left ( \sin \left ( dx+c \right ) \right ) }{d}}-iBax-{\frac{iB\cot \left ( dx+c \right ) a}{d}}-{\frac{iBac}{d}}-{\frac{Aa \left ( \cot \left ( dx+c \right ) \right ) ^{3}}{3\,d}}+{\frac{Aa\cot \left ( dx+c \right ) }{d}}+Axa+{\frac{Aac}{d}}-{\frac{aB \left ( \cot \left ( dx+c \right ) \right ) ^{2}}{2\,d}}-{\frac{aB\ln \left ( \sin \left ( dx+c \right ) \right ) }{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^4*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x)

[Out]

-1/2*I/d*A*a*cot(d*x+c)^2-I/d*A*a*ln(sin(d*x+c))-I*B*a*x-I/d*B*cot(d*x+c)*a-I/d*B*a*c-1/3*a*A*cot(d*x+c)^3/d+a
*A*cot(d*x+c)/d+A*x*a+1/d*A*a*c-1/2/d*a*B*cot(d*x+c)^2-1/d*a*B*ln(sin(d*x+c))

________________________________________________________________________________________

Maxima [A]  time = 1.67821, size = 140, normalized size = 1.57 \begin{align*} \frac{6 \,{\left (d x + c\right )}{\left (A - i \, B\right )} a - 3 \,{\left (-i \, A - B\right )} a \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \,{\left (-i \, A - B\right )} a \log \left (\tan \left (d x + c\right )\right ) + \frac{{\left (6 \, A - 6 i \, B\right )} a \tan \left (d x + c\right )^{2} + 3 \,{\left (-i \, A - B\right )} a \tan \left (d x + c\right ) - 2 \, A a}{\tan \left (d x + c\right )^{3}}}{6 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/6*(6*(d*x + c)*(A - I*B)*a - 3*(-I*A - B)*a*log(tan(d*x + c)^2 + 1) + 6*(-I*A - B)*a*log(tan(d*x + c)) + ((6
*A - 6*I*B)*a*tan(d*x + c)^2 + 3*(-I*A - B)*a*tan(d*x + c) - 2*A*a)/tan(d*x + c)^3)/d

________________________________________________________________________________________

Fricas [B]  time = 1.43306, size = 471, normalized size = 5.29 \begin{align*} \frac{{\left (18 i \, A + 12 \, B\right )} a e^{\left (4 i \, d x + 4 i \, c\right )} +{\left (-18 i \, A - 18 \, B\right )} a e^{\left (2 i \, d x + 2 i \, c\right )} +{\left (8 i \, A + 6 \, B\right )} a +{\left ({\left (-3 i \, A - 3 \, B\right )} a e^{\left (6 i \, d x + 6 i \, c\right )} +{\left (9 i \, A + 9 \, B\right )} a e^{\left (4 i \, d x + 4 i \, c\right )} +{\left (-9 i \, A - 9 \, B\right )} a e^{\left (2 i \, d x + 2 i \, c\right )} +{\left (3 i \, A + 3 \, B\right )} a\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{3 \,{\left (d e^{\left (6 i \, d x + 6 i \, c\right )} - 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} - d\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/3*((18*I*A + 12*B)*a*e^(4*I*d*x + 4*I*c) + (-18*I*A - 18*B)*a*e^(2*I*d*x + 2*I*c) + (8*I*A + 6*B)*a + ((-3*I
*A - 3*B)*a*e^(6*I*d*x + 6*I*c) + (9*I*A + 9*B)*a*e^(4*I*d*x + 4*I*c) + (-9*I*A - 9*B)*a*e^(2*I*d*x + 2*I*c) +
 (3*I*A + 3*B)*a)*log(e^(2*I*d*x + 2*I*c) - 1))/(d*e^(6*I*d*x + 6*I*c) - 3*d*e^(4*I*d*x + 4*I*c) + 3*d*e^(2*I*
d*x + 2*I*c) - d)

________________________________________________________________________________________

Sympy [B]  time = 10.1357, size = 156, normalized size = 1.75 \begin{align*} - \frac{a \left (i A + B\right ) \log{\left (e^{2 i d x} - e^{- 2 i c} \right )}}{d} + \frac{\frac{\left (6 i A a + 4 B a\right ) e^{- 2 i c} e^{4 i d x}}{d} - \frac{\left (6 i A a + 6 B a\right ) e^{- 4 i c} e^{2 i d x}}{d} + \frac{\left (8 i A a + 6 B a\right ) e^{- 6 i c}}{3 d}}{e^{6 i d x} - 3 e^{- 2 i c} e^{4 i d x} + 3 e^{- 4 i c} e^{2 i d x} - e^{- 6 i c}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**4*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x)

[Out]

-a*(I*A + B)*log(exp(2*I*d*x) - exp(-2*I*c))/d + ((6*I*A*a + 4*B*a)*exp(-2*I*c)*exp(4*I*d*x)/d - (6*I*A*a + 6*
B*a)*exp(-4*I*c)*exp(2*I*d*x)/d + (8*I*A*a + 6*B*a)*exp(-6*I*c)/(3*d))/(exp(6*I*d*x) - 3*exp(-2*I*c)*exp(4*I*d
*x) + 3*exp(-4*I*c)*exp(2*I*d*x) - exp(-6*I*c))

________________________________________________________________________________________

Giac [B]  time = 1.38009, size = 300, normalized size = 3.37 \begin{align*} \frac{A a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 3 i \, A a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 3 \, B a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 15 \, A a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 12 i \, B a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 48 \,{\left (i \, A a + B a\right )} \log \left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + i\right ) - 24 \,{\left (i \, A a + B a\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) \right |}\right ) - \frac{-44 i \, A a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 44 \, B a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 15 \, A a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + 12 i \, B a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + 3 i \, A a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 3 \, B a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + A a}{\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3}}}{24 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

1/24*(A*a*tan(1/2*d*x + 1/2*c)^3 - 3*I*A*a*tan(1/2*d*x + 1/2*c)^2 - 3*B*a*tan(1/2*d*x + 1/2*c)^2 - 15*A*a*tan(
1/2*d*x + 1/2*c) + 12*I*B*a*tan(1/2*d*x + 1/2*c) + 48*(I*A*a + B*a)*log(tan(1/2*d*x + 1/2*c) + I) - 24*(I*A*a
+ B*a)*log(abs(tan(1/2*d*x + 1/2*c))) - (-44*I*A*a*tan(1/2*d*x + 1/2*c)^3 - 44*B*a*tan(1/2*d*x + 1/2*c)^3 - 15
*A*a*tan(1/2*d*x + 1/2*c)^2 + 12*I*B*a*tan(1/2*d*x + 1/2*c)^2 + 3*I*A*a*tan(1/2*d*x + 1/2*c) + 3*B*a*tan(1/2*d
*x + 1/2*c) + A*a)/tan(1/2*d*x + 1/2*c)^3)/d